This documentation walk-through the options to extract people data from Active Directory, then upload the data to Indoor Finders.
Windows command-line tools for export employee data and photo from Active Directory, then import into Indoor Finders system.
Scheduled Task: Admin can setup Windows scheduled task to run the batch file 0-SyncNow.cmd, which will call all three batch files of export user data, import user data, and import user photos to Indoor Finders instance.
PowerShell command to export employee data and photo from Office 365, then import into Indoor Finders system.
Run Windows PowerShell as Administrator, then install the ExchangeOnline Management module (only need to install once).
PS> Install-Module -Name ExchangeOnlineManagement
PS> Import-Module ExchangeOnlineManagement
Create an encrypted Password on File
PS> (get-credential).password | ConvertFrom-SecureString | set-content "c:\passwords\password.txt"
Connect to Exchange Online
PS> $Username = "Username@domain.com"
PS> $PasswordString = "TheTextOnTheEncryptedOnFile"
PS> $SecPasswd = ConvertTo-SecureString $PasswordString;
PS> $Credentials = New-Object System.Management.Automation.PSCredential ($Username, $SecPasswd)
PS> Connect-ExchangeOnline -Credential $Credentials
#Export
PS> $MBXs = Get-Mailbox -ResultSize unlimited -RecipientTypeDetails UserMailbox |
select Identity,DisplayName,PrimarySmtpAddress
&{foreach ($MBX in $MBXs){
$User = Get-User $MBX.Identity
New-Object psobject -Property @{
Identity = $MBX.Identity
Email = $MBX.PrimarySmtpAddress
DisplayName = $MBX.DisplayName
FirstName = $User.FirstName
LastName = $User.LastName
JobTitle = $User.Title
Department = $User.Department
PrimaryOfficeLocation = $User.Office
MgrName = $User.Manager
Phone = $User.Phone
MobilePhone = $User.MobilePhone
OtherPhone = $User.OtherTelephone
}
}
}| export-csv "C:\DataSync\UserList.csv" -notype
#Import
PS> [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.SecurityProtocolType]::Tls12;
PS> $wc = new-object System.Net.WebClient
PS> $wc.UploadFile("https://YOUR-DOMAIN-NAME.indoorfinders.com/webapi/PeopleDataUpload.ashx?key=YOU-API-KEY&cleanupAction=delete","c:\DataSync\UserList.csv")
#Export
PS> $MBXs = Get-Mailbox -ResultSize unlimited -RecipientTypeDetails UserMailbox |
select Identity,DisplayName,PrimarySmtpAddress
&{foreach ($MBX in $MBXs){
$wc.DownloadFile("https://Outlook.Office365.com/ews/Exchange.asmx/s/GetUserPhoto?email="+$MBX.PrimarySmtpAddress+"&size=HR240x240","C:\DataSync\Photo\"+$MBX.PrimarySmtpAddress+".jpg")
$User = Get-User $MBX.Identity
New-Object psobject -Property @{
Identity = $MBX.Identity
Email = $MBX.PrimarySmtpAddress
DisplayName = $MBX.DisplayName
FirstName = $User.FirstName
LastName = $User.LastName
JobTitle = $User.Title
Department = $User.Department
PrimaryOfficeLocation = $User.Office
MgrName = $User.Manager
Phone = $User.Phone
MobilePhone = $User.MobilePhone
OtherPhone = $User.OtherTelephone
}
}
}| export-csv "C:\DataSync\UserlistPhoto.csv" -notype
#Zip photosPS> Compress-Archive -Force -Path C:\IFS\ScheduleTasks\Aerohive\Photo\*.* -DestinationPath c:\DataSync\Photos.zip
#ImportPS> [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.SecurityProtocolType]::Tls12;
PS> $wc = new-object System.Net.WebClient
PS> $wc.UploadFile("https://YOUR-DOMAIN-NAME.indoorfinders.com/webapi/PeopleDataUpload.ashx?key=YOUR-API-KEY&cleanupAction=delete","C:\DataSync\UserListPhoto.csv")
PS> $wc.UploadFile("https://YOUR-DOMAIN-NAME.indoorfinders.com/webapi/PeoplePhotoBulkUpload.ashx?key=YOUR-API-KEY","C:\DataSync\Photos.zip")